package mymatch

import scala.util.Random

object TypeMatchDemo {
  def main(args: Array[String]): Unit = {
    val array = Array(1, "yu", 2332.55f, 4545.43)

    val value1 = array(Random.nextInt(array.length))

    println(value1)
    value1 match {
      case x:Int => println("Int:"+x)
      case x:String => println("String:" + x)
      case x:Float if (x < 0)=> println("Float:" + x)
      case x:Double => println("Double: " + x)
      case _ => println("dummy:")
    }
  }
}
